) %>%
summarise(
NP_mean = mean(NP, na.rm = TRUE),
NK_mean = mean(NK, na.rm = TRUE),
KP_mean = mean(KP, na.rm = TRUE),
n = sum(!is.na(NP))
)
range(basis_data$mean_temp_simple_Mar.Dec, na.rm = TRUE)
####### Nutrient ratio calculations ######
rh <- nutrients %>%
filter(sample == "rhizome") %>%
mutate(
N_mg_g = N_perc_plant * 10,
N_mmol_g = N_mg_g / 14.0067,
P_mmol_g = P_mg_g_plant / 30.973762,
K_mmol_g = K_mg_g_plant / 39.0983,
NP = N_mmol_g / P_mmol_g,
NK = N_mmol_g / K_mmol_g,
KP = K_mmol_g / P_mmol_g
)
rh %>%
group_by(Plot, Pseudoreplikat) %>%
summarise(
NP = mean(NP, na.rm = TRUE),
NK = mean(NK, na.rm = TRUE),
KP = mean(KP, na.rm = TRUE),
.groups = "drop"
) %>%
summarise(
NP_mean = mean(NP, na.rm = TRUE),
NK_mean = mean(NK, na.rm = TRUE),
KP_mean = mean(KP, na.rm = TRUE),
n = sum(!is.na(NP))
)
####### Nutrient ratio calculations ######
rh <- nutrients %>%
filter(sample == "rhizome") %>%
mutate(
N_mg_g = N_perc_plant * 10,
N_mmol_g = N_mg_g / 14.0067,
P_mmol_g = P_mg_g_plant / 30.973762,
K_mmol_g = K_mg_g_plant / 39.0983,
NP = N_mmol_g / P_mmol_g,
NK = N_mmol_g / K_mmol_g,
KP = K_mmol_g / P_mmol_g
)
rh %>%
group_by(Plot) %>%
summarise(
NP = mean(NP, na.rm = TRUE),
NK = mean(NK, na.rm = TRUE),
KP = mean(KP, na.rm = TRUE),
.groups = "drop"
) %>%
summarise(
NP_mean = mean(NP, na.rm = TRUE),
NK_mean = mean(NK, na.rm = TRUE),
KP_mean = mean(KP, na.rm = TRUE),
n = sum(!is.na(NP))
)
ro <- nutrients %>%
filter(sample == "root") %>%
mutate(
N_mg_g = N_perc_plant * 10,
N_mmol_g = N_mg_g / 14.0067,
P_mmol_g = P_mg_g_plant / 30.973762,
K_mmol_g = K_mg_g_plant / 39.0983,
NP = N_mmol_g / P_mmol_g,
NK = N_mmol_g / K_mmol_g,
KP = K_mmol_g / P_mmol_g
)
ro %>%
group_by(Plot) %>%
summarise(
NP = mean(NP, na.rm = TRUE),
NK = mean(NK, na.rm = TRUE),
KP = mean(KP, na.rm = TRUE),
.groups = "drop"
) %>%
summarise(
NP_mean = mean(NP, na.rm = TRUE),
NK_mean = mean(NK, na.rm = TRUE),
KP_mean = mean(KP, na.rm = TRUE),
n = sum(!is.na(NP))
)
setwd("~/Meline_2/Rohrmahdflächen/Publikation_Torfbildungspotential_Schilf/Raw_data/Statistics/Bodentemperatur")
library(dplyr)
library(tidyr)
library(stringr)
library(lubridate)
library(ggplot2)
library(dplyr)
library(tidyr)
library(stringr)
library(lubridate)
library(ggplot2)
library(purrr)
plot_files <- c(
Plot_05 = "Plot_5.csv",
Plot_11 = "Plot_11.csv",
Plot_12 = "Plot_12.csv",
Plot_14 = "Plot_14.csv",
Plot_15 = "Plot_15.csv",
Plot_20 = "Plot_20.csv",
Plot_21 = "Plot_21.csv",
Plot_22 = "Plot_22.csv",
Plot_24 = "Plot_24.csv",
Plot_25 = "Plot_25.csv",
Plot_26 = "Plot_26.csv",
Plot_28 = "Plot_28.csv",
Plot_30 = "Plot_30.csv",
Plot_31 = "Plot_31.csv",
Plot_32 = "Plot_32.csv",
Plot_33 = "Plot_33.csv",
Plot_34 = "Plot_34.csv",
Plot_35 = "Plot_35.csv",
Plot_36 = "Plot_36.csv"
)
datasets_list <- imap(plot_files, ~ {
dat <- read.csv(.x, sep = ";")
dat$datetime <- as.POSIXct(
dat$datetime,
format = "%d.%m.%Y %H:%M",
tz = "CET"
)
temp_column <- if (.y == "Plot_05") {
"t2_Plot_5"
} else {
paste0("t2_", .y)
}
dat %>%
mutate(date = as.Date(datetime)) %>%
group_by(date) %>%
summarise(
daily_mean = mean(.data[[temp_column]], na.rm = TRUE)
)
})
datasets_list <- imap(
datasets_list,
~ rename(.x, !!.y := daily_mean)
)
Tagesmittelwerte_Temp_plotweise <- reduce(
datasets_list,
full_join,
by = "date"
)
# Lange Tabelle erzeugen
long_daily <- Tagesmittelwerte_Temp_plotweise %>%
pivot_longer(
-date,
names_to = "plot",
values_to = "temp"
)
long_daily <- Tagesmittelwerte_Temp_plotweise %>%
pivot_longer(
-date,
names_to = "plot",
values_to = "temp"
)
simple_means <- long_daily %>%
group_by(plot) %>%
summarise(
mean_simple = mean(temp, na.rm = TRUE),
.groups = "drop"
)
monthly_means <- long_daily %>%
mutate(
month = as.integer(format(date, "%m"))
) %>%
group_by(plot, month) %>%
summarise(
m = mean(temp, na.rm = TRUE),
.groups = "drop"
)
plot_files <- c(
Plot_05 = "Plot_5.csv",
Plot_11 = "Plot_11.csv",
Plot_12 = "Plot_12.csv",
Plot_14 = "Plot_14.csv",
Plot_15 = "Plot_15.csv",
Plot_20 = "Plot_20.csv",
Plot_21 = "Plot_21.csv",
Plot_22 = "Plot_22.csv",
Plot_24 = "Plot_24.csv",
Plot_25 = "Plot_25.csv",
Plot_26 = "Plot_26.csv",
Plot_28 = "Plot_28.csv",
Plot_30 = "Plot_30.csv",
Plot_31 = "Plot_31.csv",
Plot_32 = "Plot_32.csv",
Plot_33 = "Plot_33.csv",
Plot_34 = "Plot_34.csv",
Plot_35 = "Plot_35.csv",
Plot_36 = "Plot_36.csv"
)
datasets_list <- imap(plot_files, ~ {
dat <- read.csv(.x, sep = ";")
dat$datetime <- as.POSIXct(
dat$datetime,
format = "%d.%m.%Y %H:%M",
tz = "CET"
)
temp_column <- if (.y == "Plot_05") {
"t2_Plot_5"
} else {
paste0("t2_", .y)
}
dat %>%
mutate(date = as.Date(datetime)) %>%
group_by(date) %>%
summarise(
daily_mean = mean(.data[[temp_column]], na.rm = TRUE),
.groups = "drop"
)
})
datasets_list <- imap(
datasets_list,
~ rename(.x, !!.y := daily_mean)
)
Tagesmittelwerte_Temp_plotweise <- reduce(
datasets_list,
full_join,
by = "date"
)
long_daily <- Tagesmittelwerte_Temp_plotweise %>%
pivot_longer(
-date,
names_to = "plot",
values_to = "temp"
)
Jahresmittelwerte <- long_daily %>%
group_by(plot) %>%
summarise(
mean_simple = mean(temp, na.rm = TRUE),
.groups = "drop"
)
print(Jahresmittelwerte, n = Inf)
setwd("~/Meline_2/Rohrmahdflächen/Publikation_Torfbildungspotential_Schilf/Raw_data/Statistics/Torfbildungspotential")
acc <- read.csv("belowground_accumulation.csv", sep = ";")
dec <- read.csv("belowground_decomposition.csv", sep = ";")
library(dplyr)
# Dreisatz, um die BM-accumulation auf einen qm hochzurechnen
convert_to_per_m2 <- function(value_per_27_77cm2) {
value_per_27_77cm2 * (10000 / 27.77)
}
# Vorbereitung belowground biomass
acc <- acc %>%
mutate(BM_accumulation_belowground_per_m2 = convert_to_per_m2(BM_accumulation_belowground_g))
############## below-above-ratio #####
acc_above_reed <- read.csv("aboveground_production.csv", sep = ";")
acc_below <- acc
head(acc_below)
head(acc_above_reed)
acc <- read.csv("belowground_accumulation.csv", sep = ";")
dec <- read.csv("belowground_decomposition.csv", sep = ";")
library(dplyr)
convert_to_per_m2 <- function(value_per_27_77cm2) {
value_per_27_77cm2 * (10000 / 27.77)
}
acc <- acc %>%
mutate(BM_accumulation_belowground_per_m2 = convert_to_per_m2(BM_accumulation_belowground_g))
###################################
# mean Bm producition summed across depths
total_mean <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Plot, Pseudoreplikat) %>%
summarise(
bm_sum = sum(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
summarise(
mean = mean(bm_sum, na.rm = TRUE),
sd   = sd(bm_sum, na.rm = TRUE),
n    = sum(!is.na(bm_sum)),
.groups = "drop"
)
total_mean
total_mean <- total_mean %>%
mutate(
mean_t_ha = mean * 0.01,
sd_t_ha   = sd * 0.01
)
total_mean
# Belowground biomass for each depth
depth_means <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Plot, Pseudoreplikat, Bodentiefe) %>%
summarise(
bm_rep_depth = mean(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
group_by(Bodentiefe) %>%
summarise(
mean = mean(bm_rep_depth, na.rm = TRUE),
sd   = sd(bm_rep_depth, na.rm = TRUE),
n    = sum(!is.na(bm_rep_depth)),
.groups = "drop"
)
depth_means
depth_means <- depth_means %>%
mutate(
mean_t_ha = mean * 0.01,
sd_t_ha   = sd * 0.01
)
depth_means
mean_depth_1 <- depth_means$mean[depth_means$Bodentiefe == 1]
mean_depth_2 <- depth_means$mean[depth_means$Bodentiefe == 2]
mean_depth_3 <- depth_means$mean[depth_means$Bodentiefe == 3]
abnahme_1_2 <- (mean_depth_1 - mean_depth_2) / mean_depth_1 * 100
abnahme_1_3 <- (mean_depth_1 - mean_depth_3) / mean_depth_1 * 100
abnahme_1_2
abnahme_1_3
###################################
# Belowground biomass per site
flaeche_mean <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Flaeche, Plot, Pseudoreplikat) %>%
summarise(
bm_sum = sum(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
group_by(Flaeche) %>%
summarise(
bm_flaeche = mean(bm_sum, na.rm = TRUE),
sd = sd(bm_sum, na.rm = TRUE),
n = sum(!is.na(bm_sum)),
.groups = "drop"
)
flaeche_mean
flaeche_mean <- flaeche_mean %>%
mutate(
mean_t_ha = bm_flaeche * 0.01,
sd_t_ha   = sd * 0.01
)
flaeche_mean
subset_acc_depth_1_and_3 <- acc %>%
filter(Bodentiefe %in% c(1, 3))
subset_acc_depth_1_and_3 <- subset_acc_depth_1_and_3 %>%
mutate(Bodentiefe = ifelse(Bodentiefe == 3, 2, Bodentiefe))
combi_acc_dec_depth_wise <- subset_acc_depth_1_and_3 %>%
inner_join(dec, by = c("Plot", "Pseudoreplikat", "Bodentiefe", "Flaeche"))
acc_vs_dec_depth_wise <- combi_acc_dec_depth_wise %>%
mutate(
peat_formation_potential_depth_wise = BM_accumulation_belowground_per_m2 -
BM_accumulation_belowground_per_m2 * mittlerer_prozentualer_Gewichtsverlust_Wurzeln_Rhizome / 100
)
print(acc_vs_dec_depth_wise)
###################################
# PFP averaged over depths (acc for all three depths, dec for two depths)
acc_avg <- acc %>%
group_by(Plot, Pseudoreplikat) %>%
summarize(
BM_accumulation_belowground_avg = mean(BM_accumulation_belowground_per_m2, na.rm = TRUE)
) %>%
ungroup()
acc_avg
dec_avg <- dec %>%
group_by(Plot, Pseudoreplikat) %>%
summarize(
mittlerer_prozentualer_Gewichtsverlust_avg = mean(mittlerer_prozentualer_Gewichtsverlust_Wurzeln_Rhizome, na.rm = TRUE)
) %>%
ungroup()
combi_acc_dec_avg <- acc_avg %>%
inner_join(dec_avg, by = c("Plot", "Pseudoreplikat"))
acc_vs_dec_avg <- combi_acc_dec_avg %>%
mutate(
peat_formation_potential_avg = BM_accumulation_belowground_avg -
BM_accumulation_belowground_avg * mittlerer_prozentualer_Gewichtsverlust_avg / 100
)
print(acc_vs_dec_avg)
############## below-above-ratio #####
acc_above_reed <- read.csv("aboveground_production.csv", sep = ";")
acc_below <- acc
head(acc_below)
head(acc_above_reed)
acc_below %>%
group_by(Flaeche, Plot, Pseudoreplikat, Bodentiefe) %>%
summarise(
bm_rep_depth = mean(BM_accumulation_belowground_per_m2, na.rm = TRUE),
.groups = "drop"
) %>%
group_by(Flaeche, Bodentiefe) %>%
summarise(
mean_bm_g_m2 = mean(bm_rep_depth, na.rm = TRUE),
sd_bm_g_m2   = sd(bm_rep_depth, na.rm = TRUE),
n            = sum(!is.na(bm_rep_depth)),
.groups      = "drop"
)
library(dplyr)
acc <- read.csv("belowground_accumulation.csv", sep = ";")
dec <- read.csv("belowground_decomposition.csv", sep = ";")
convert_to_per_m2 <- function(value_per_27_77cm2) {
value_per_27_77cm2 * (10000 / 27.77)
}
acc <- acc %>%
mutate(BM_accumulation_belowground_per_m2 = convert_to_per_m2(BM_accumulation_belowground_g))
# mean Bm production summed across depths
total_mean <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Plot, Pseudoreplikat) %>%
summarise(
bm_sum = sum(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
summarise(
mean = mean(bm_sum, na.rm = TRUE),
sd   = sd(bm_sum, na.rm = TRUE),
n    = sum(!is.na(bm_sum)),
.groups = "drop"
)
total_mean <- total_mean %>%
mutate(
mean_t_ha = mean * 0.01,
sd_t_ha   = sd * 0.01
)
# Belowground biomass for each depth
depth_means <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Plot, Pseudoreplikat, Bodentiefe) %>%
summarise(
bm_rep_depth = mean(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
group_by(Bodentiefe) %>%
summarise(
mean = mean(bm_rep_depth, na.rm = TRUE),
sd   = sd(bm_rep_depth, na.rm = TRUE),
n    = sum(!is.na(bm_rep_depth)),
.groups = "drop"
)
depth_means <- depth_means %>%
mutate(
mean_t_ha = mean * 0.01,
sd_t_ha   = sd * 0.01
)
mean_depth_1 <- depth_means$mean[depth_means$Bodentiefe == 1]
mean_depth_2 <- depth_means$mean[depth_means$Bodentiefe == 2]
mean_depth_3 <- depth_means$mean[depth_means$Bodentiefe == 3]
abnahme_1_2 <- (mean_depth_1 - mean_depth_2) / mean_depth_1 * 100
abnahme_1_3 <- (mean_depth_1 - mean_depth_3) / mean_depth_1 * 100
# Belowground biomass per site
flaeche_mean <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Flaeche, Plot, Pseudoreplikat) %>%
summarise(
bm_sum = sum(BM_accumulation_belowground_per_m2),
.groups = "drop"
) %>%
group_by(Flaeche) %>%
summarise(
bm_flaeche = mean(bm_sum, na.rm = TRUE),
sd = sd(bm_sum, na.rm = TRUE),
n = sum(!is.na(bm_sum)),
.groups = "drop"
)
flaeche_mean <- flaeche_mean %>%
mutate(
mean_t_ha = bm_flaeche * 0.01,
sd_t_ha   = sd * 0.01
)
# calculation peat formation potential for depths 0-10 cm und 20-30 cm
subset_acc_depth_1_and_3 <- acc %>%
filter(Bodentiefe %in% c(1, 3))
subset_acc_depth_1_and_3 <- subset_acc_depth_1_and_3 %>%
mutate(Bodentiefe = ifelse(Bodentiefe == 3, 2, Bodentiefe))
combi_acc_dec_depth_wise <- subset_acc_depth_1_and_3 %>%
inner_join(dec, by = c("Plot", "Pseudoreplikat", "Bodentiefe", "Flaeche"))
acc_vs_dec_depth_wise <- combi_acc_dec_depth_wise %>%
mutate(
peat_formation_potential_depth_wise = BM_accumulation_belowground_per_m2 -
BM_accumulation_belowground_per_m2 * mittlerer_prozentualer_Gewichtsverlust_Wurzeln_Rhizome / 100
)
# below-above-ratio
acc_above_reed <- read.csv("aboveground_production.csv", sep = ";")
below_sum <- acc %>%
filter(!is.na(BM_accumulation_belowground_per_m2)) %>%
group_by(Flaeche, Plot, Pseudoreplikat) %>%
summarise(
BM_below_total = sum(BM_accumulation_belowground_per_m2),
.groups = "drop"
)
below_sum <- below_sum %>%
mutate(
BM_below_total_t_ha = BM_below_total * 0.01
)
above_plot <- acc_above_reed %>%
transmute(
Plot = plot_nr,
Flaeche = case_when(
plot_location == "Usedom_Balm" ~ "Balm",
plot_location == "Anklam_FerneWiesen" ~ "Ferne_Wiesen",
plot_location == "Ruegen_Ummanz" ~ "Lieschower_Wiek",
plot_location == "Ruegen_Dreschvitz" ~ "Sehrow_Bach",
plot_location == "Usedom_Ueckeritz" ~ "Ueckeritz",
TRUE ~ NA_character_
),
BM_above_t_ha = dw_Gesamtprobe_T_ha
) %>%
filter(!is.na(Flaeche))
common_plot_data <- below_sum %>%
inner_join(above_plot, by = c("Flaeche", "Plot")) %>%
mutate(
root_shoot_ratio = BM_below_total_t_ha / BM_above_t_ha
)
ratio_summary <- common_plot_data %>%
group_by(Flaeche) %>%
summarise(
ratio_mean = mean(root_shoot_ratio, na.rm = TRUE),
ratio_sd = sd(root_shoot_ratio, na.rm = TRUE),
n = sum(!is.na(root_shoot_ratio)),
.groups = "drop"
)
